<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
<title>商品表</title>
<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.commodityname" @keyup.enter="query" placeholder="商品名称">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<!--<a class="btn btn-primary" @click="query2"><i class="fa fa-th-list">&nbsp;查看</i></a>-->
			<#if shiro.hasPermission("sys:commodity:save")>
            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			</#if>
			<#if shiro.hasPermission("sys:commodity:update")>
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			</#if>
			<#if shiro.hasPermission("sys:commodity:delete")>
            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			</#if>
			<a class="btn btn-primary" @click="getPropertyList"><i class="fa fa-plus">&nbsp;查看属性</i></a>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>
    
    <div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
									<div class="form-group">
			   	<div class="col-sm-2 control-label">商品名称:</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="commodity.commodityname" placeholder="商品名称"/>
			    </div>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">商品编号:</div>
			   	<div class="col-sm-10">
			      <input type="text" class="form-control" v-model="commodity.commoditynum" placeholder="商品编号"/>
			    </div>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">选择分类:</div>
			   	<div class="col-sm-10">
					<select v-model="commodity.categoryid" style="width: 200px">
						<option selected  value="">请选择</option>
						<option v-for="sel in sels" v-bind:value="sel.id">{{sel.categoryyname}}</option>
					</select>
			    </div>
			</div>

			<div class="form-group">
				<div class="col-sm-2 control-label">上传图片:</div>
				<div class="col-sm-10">
					<input type="file" accept="image/gif,image/jpeg,image/jpg,image/png" ref="file" id="file" name="file" @change="changeImage($event)" class="form-control" placeholder="图片"/>

					<div
						class="pica"
						style="
						position: fixed;
						right: 20px;
						top: 0;
						width: 300px;
						bottom: 0px;
						overflow-y: scroll;
						border-radius: 4px;
						opacity: 0.8;
					    border: 1px solid #DDD;

						">
						<div style="background-color: #EEE;padding: 4px;">图片列表</div>
						<div style="width: 100%;position: relative;" v-for="(one , index) of JSON.parse(commodity.picurl)">
							<div @click="removePic(index)" style="position: absolute;right:0;top: 0;background-color: #BBB;padding: 2px 4px;font-size: 14px;">删除该图片</div>
							<img  style="width: 100%" :src="one"  style="max-width: 400px">
						</div>

					</div>

				</div>
			</div>

			<div class="form-group">
				<div class="col-sm-2 control-label">普通价格:</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="commodity.price" placeholder="普通价格"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">会员价:</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="commodity.pricediscounts" placeholder="会员价"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">销量:</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="commodity.salesnum" placeholder="销量"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">邮费:</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="commodity.freight" placeholder="邮费"/>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">规格参数:</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="commodity.parameter" placeholder="规格参数"/>
				</div>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否需要支付:</div>
					<label class="radio-inline">
						<input type="radio" name="ispay" value="false" v-model="commodity.ispay"/> 否
					</label>
					<label class="radio-inline">
						<input type="radio" name="ispay" value="true" v-model="commodity.ispay"/> 是
					</label>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否新品:</div>
										<label class="radio-inline">
											<input type="radio" name="isnew" value="false" v-model="commodity.isnew"/> 否
										</label>
										<label class="radio-inline">
											<input type="radio" name="isnew" value="true" v-model="commodity.isnew"/> 是
										</label>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否推荐:</div>
										<label class="radio-inline">
											<input type="radio" name="isrecommend" value="false" v-model="commodity.isrecommend"/> 否
										</label>
										<label class="radio-inline">
											<input type="radio" name="isrecommend" value="true" v-model="commodity.isrecommend"/> 是
										</label>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否热门:</div>
										<label class="radio-inline">
											<input type="radio" name="ishot" value="false" v-model="commodity.ishot"/> 否
										</label>
										<label class="radio-inline">
											<input type="radio" name="ishot" value="true" v-model="commodity.ishot"/> 是
										</label>
			</div>
									<!--<div class="form-group">-->
			   	<!--<div class="col-sm-2 control-label">商品详情:</div>-->
			   	<!--<div class="col-sm-10">-->
			      <!--<input type="text" class="form-control" v-model="commodity.commoditydetails" placeholder="商品详情"/>-->
			    <!--</div>-->
			<!--</div>-->
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否明星商品:</div>
										<label class="radio-inline">
											<input type="radio" name="celebrity" value="false" v-model="commodity.celebrity"/> 否
										</label>
										<label class="radio-inline">
											<input type="radio" name="celebrity" value="true" v-model="commodity.celebrity"/> 是
										</label>
			</div>
									<div class="form-group">
			   	<div class="col-sm-2 control-label">是否优选商品:</div>
										<label class="radio-inline">
											<input type="radio" name="preferred" value="false" v-model="commodity.preferred"/> 否
										</label>
										<label class="radio-inline">
											<input type="radio" name="preferred" value="true" v-model="commodity.preferred"/> 是
										</label>
			</div>
			<!--<div class="form-group">-->
			<!--<div class="col-sm-2 control-label">商品详情:</div>-->
			<div>
				<textarea style="width: 1000px;height: 500px" id="container" name="content" type="text/plain" charset="UTF-8">
				</textarea>
			</div>
			<!--</div>-->
							<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/commodity.js?_${.now?long}"></script>

<!-- 配置文件 -->
<script type="text/javascript" src="${request.contextPath}/statics/js/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${request.contextPath}/statics/js/ueditor/ueditor.all.js"></script>
</body>
</html>